using System;
using System.Threading;
using DZTC.Base32Utility.Core;
using NUnit.Framework;

namespace DZTC.Base32Utility.Tests
{
    [TestFixture]
    internal class ProgressTests
    {
        [Test]
        public void BasicTest()
        {
            var pt = new ProgressReporter();

            pt.SetMax(1000);
            pt.ProgressChanged += (val, max) => Assert.AreEqual(950, val);
            pt.Report(950);
        }


        [Test]
        public void OverflowTest()
        {
            var pt = new ProgressReporter();

            pt.SetMax(1000);
            Assert.Throws<ArgumentException>(() => pt.Report(1950));
        }


        [Test]
        public void UnderflowTest()
        {
            var pt = new ProgressReporter();

            pt.SetMax(1000);
            Assert.Throws<ArgumentException>(() => pt.Report(1950));
        }
    }
}